

*Set working directory
cd "/path/to/replication"

*Open file from Italian National Election Studies
	use "data/Itanes_2018_release01_panel_pre_post.dta", clear

*Prejudice
*Question asked June 2016, before referendum
*Do we have too many immigrants?
	replace img1 =. if img1==8
	gen prejudice=7 if img1==1
	replace prejudice=6 if img1==2
	replace prejudice=5 if img1==3
	replace prejudice=4 if img1==4
	replace prejudice=3 if img1==5
	replace prejudice=2 if img1==6
	replace prejudice=1 if img1==7

*Far right collocation
*Question asked after referendum
*Where do you position yourself on a scale from 1 (far-left) to 10 (far-right)?
	replace lrself=. if lrself==11|lrself==88
	gen farright_position =lrself

*Far right voting
	gen farright_voting=0
	replace farright_voting=1 if voto1==9|voto1==10
	gen lega=0
	replace lega=1 if voto1==9
	gen fi=0
	replace fi=1 if voto1==10

*Label
	label var lega "Lega (0-1)"
	label var fi "Brothers of Italy (0-1)"
	label var farright_position "Self-positioning left-right (1-7)"
	
*Table I.1
	su prejudice
	local meandv=r(mean)
	reg prejudice lega dem09 dem11 dem01 dem02 i.dem05, r
	outreg2 using "correl_farright_itanes.tex", replace keep(lega) addtext(Province FE, Y, Controls, Y) addstat(Mean DV, `meandv') label nocons dec(3)
	reg prejudice fi dem09 dem11 dem01 dem02 i.dem05, r
	outreg2 using "correl_farright_itanes.tex", keep(fi) addtext(Province FE, Y, Controls, Y) addstat(Mean DV, `meandv') label nocons dec(3)
	reg prejudice farright_position dem09 dem11 dem01 dem02 i.dem05, r
	outreg2 using "correl_farright_itanes.tex", keep(farright_position) addtext(Province FE, Y, Controls, Y) addstat(Mean DV, `meandv') label nocons dec(3)


